package com.qf.springbootopenapi.vo;

import com.qf.springbootopenapi.utils.Constants;

import java.util.HashMap;

/**
 * @BelongsProject: open-api-based-on-springboot
 * @BelongsPackage: com.qf.springbootopenapi.vo
 * @Author: YuanSir
 * @CreateTime: 2022-10-19  15:24
 * @Description:
 * @Version: 1.0
 */

public class ReturnMapVo extends HashMap {
    
    
    public static ReturnMapVo ok(){
    
        ReturnMapVo returnMapVo = new ReturnMapVo();
        returnMapVo.put("code", Constants.SUCCESS_CODE);
        returnMapVo.put("msg", "ok");
        
        return returnMapVo;
    
    }
    
    
    public static ReturnMapVo fail(){
        ReturnMapVo returnMapVo = new ReturnMapVo();
        returnMapVo.put("code", Constants.FAIL_CODE);
        returnMapVo.put("msg", "fail");
        
        return returnMapVo;
    }
    
    public static ReturnMapVo fail(String msg) {
        ReturnMapVo returnMapVo = new ReturnMapVo();
        returnMapVo.put("code", Constants.ParamNull_CODE);
        returnMapVo.put("msg", msg);
    
        return returnMapVo;
    }
}
